package com.weipai.demo.controller;

import com.weipai.demo.service.SmsService;
import com.weipai.demo.util.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 短信验证码接口
 *
 * @author songmengqiang
 * @create 2018-09-13 14:50
 **/
@RestController
public class SmsController {

    @Autowired
    private SmsService smsService;

    /**
     * 发送验证码
     * @param phone
     * @return
     */
    @RequestMapping(value = "/sms/sendCode", method = RequestMethod.POST)
    public Response sendCode(String phone) {
        return smsService.sendCode(phone);
    }

    /**
     * 验证码
     * @param code
     * @return
     */
    @RequestMapping(value = "/sms/verifyCode", method = RequestMethod.POST)
    public Response verifyCode(String code) {
        return smsService.verifyCode(code);
    }
}
